package com.exm.collectcodenew.web.controller;

import com.exm.collectcodenew.configManage.ConfigBean;
import com.exm.collectcodenew.configManage.UserBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableConfigurationProperties({ConfigBean.class, UserBean.class})
public class LucyController {
    @Value("${my.name}")
    private String name;
    @Value("${my.age}")
    private int age;
    @Autowired
    ConfigBean configBean;
    @Autowired
    UserBean userBean;
    @RequestMapping("/miya")
    public String miya(){
        return name+":"+age;
    }
    @RequestMapping("/lucy")
    public String lucy(){
        return configBean.getGreeting()+"-"+configBean.getName()+"-"+configBean.getUuid()+"-"+configBean.getMax();
    }

    @RequestMapping(value = "/userBean")
    public String userBean(){
        return userBean.getName()+":"+userBean.getAge();
    }

}
